<template>
  <div class="nation">
    <el-checkbox-group v-model="model.exposeList">
      <el-checkbox label="1" @change="handlerCheckBox('1')">无</el-checkbox>
      <el-checkbox label="2" @change="handlerCheckBox('2')">化学品</el-checkbox>
      <el-checkbox label="3" @change="handlerCheckBox('3')">毒物</el-checkbox>
      <el-checkbox label="4" @change="handlerCheckBox('4')">射线</el-checkbox>
    </el-checkbox-group>
  </div>
</template>

<script>
export default {
  props: {
    model: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {}
  },
  methods: {
    handlerCheckBox(value) {
      // console.log(value)
      const emptyVal = "1"
      const currentIsChecked = this.model.exposeList.includes(value)
      if (value === emptyVal && currentIsChecked) {
        this.model.exposeList = ["1"]
      } else if (value !== emptyVal) {
        this.model.exposeList = this.model.exposeList.filter(v => v > 1)
      }
      // console.log(this.model.exposeList)
    }
  }
}
</script>
<style lang="scss" scoped>
.nation {
  // display: flex;
  .el-input {
    margin-left: 15px;
  }
}
</style>
